﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
using KPIS.GERP.HtmlHelpers;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using System.Linq.Expressions;
using System.Text;

namespace KPIS.GERP.WEB.GIMS.Classes
{
	public static class XmlHelper
	{
		public static XmlDocument LoadXML(string xmlPath)
		{
			XmlDocument xmlDocumentTemp = new XmlDocument();
			XmlTextReader reader = new XmlTextReader(MvcUrlHelper.MapPath(xmlPath));
			reader.WhitespaceHandling = WhitespaceHandling.None;
			xmlDocumentTemp.Load(reader);
			reader.Close();
			return xmlDocumentTemp;
		}

		public static string FetchAttributeValue(XmlNode xmlNode, string attributeName)
		{
			if (xmlNode == null || xmlNode.Attributes == null || xmlNode.Attributes[attributeName] == null) return null;

			return xmlNode.Attributes[attributeName].Value;
		}
	}

} 